class CreateSysParams < ActiveRecord::Migration
  def self.up
    create_table :sys_params do |t|
      t.integer :company_id    ,:null => false  #所属公司的ID
      t.string  :company_name  ,:null => false  #公司全称
      t.string  :company_name_ab  ,:null => false  #名称简称
      t.integer :employee_id   ,:null => false  #添加，编辑者
      t.string  :description                    #写一些备注之类的信息
      t.string  :audit_for_sale_add                        ,:limit => 10 ,:default => '否' #新增销售订单是否需要审批
      t.string  :audit_for_loan_add                        ,:limit => 10 ,:default => '否' #新增借货订单是否需要审批
      t.string  :audit_for_purchase_add                    ,:limit => 10 ,:default => '否' #新增采购订单是否需要审批
      t.string  :audit_for_purchase_edit                   ,:limit => 10 ,:default => '否' #编辑采购订单是否需要审批
      t.string  :audit_for_transfer_add                    ,:limit => 10 ,:default => '否' #新增调拨订单是否需要审批
      t.string  :audit_for_separate_add                    ,:limit => 10 ,:default => '否' #新增拆分订单是否需要审批
      t.string  :audit_for_assembly_add                    ,:limit => 10 ,:default => '否' #新增组合订单是否需要审批
      t.string  :audit_for_opening_stock_add               ,:limit => 10 ,:default => '否' #新增期初订单是否需要审批
      t.string  :audit_for_warehousing_entry_cancel        ,:limit => 10 ,:default => '否' #入库单撤销是否需要审批
      t.string  :audit_for_sale_cancel                     ,:limit => 10 ,:default => '否' #销售订单撤销是否需要审批
      t.string  :audit_for_loan_cancel                     ,:limit => 10 ,:default => '是' #借货订单撤销是否需要审批
      t.string  :audit_for_purchase_cancel                 ,:limit => 10 ,:default => '否' #采购订单撤销是否需要审批
      t.string  :audit_for_delivery_add                    ,:limit => 10 ,:default => '否' #出库单撤销是否需要审批
      t.string  :audit_for_delivery_cancel                 ,:limit => 10 ,:default => '否' #出库单撤销是否需要审批
      t.string  :audit_for_separate_cancel                 ,:limit => 10 ,:default => '否' #拆分订单撤销是否需要审批
      t.string  :audit_for_assembly_cancel                 ,:limit => 10 ,:default => '否' #组合订单撤销是否需要审批
      t.string  :audit_for_transfer_cancel                 ,:limit => 10 ,:default => '否' #调拨订单撤销是否需要审批
      t.string  :audit_for_opening_stock_cancel            ,:limit => 10 ,:default => '否' #期初订单撤销是否需要审批
      t.string  :audit_for_sale_returned_cancel            ,:limit => 10 ,:default => '否' #销售退货订单撤销是否需要审批
      t.string  :audit_for_purchase_returned_cancel        ,:limit => 10 ,:default => '否' #采购退货订单撤销是否需要审批
      t.string  :audit_for_claim_cancel                    ,:limit => 10 ,:default => '否' #索赔订单撤销是否需要审批
      t.string  :audit_for_claim_returned_cancel           ,:limit => 10 ,:default => '否' #索赔返库订单撤销是否需要审批
      t.string  :audit_for_loan_returned_cancel            ,:limit => 10 ,:default => '否' #索赔返库订单撤销是否需要审批
      t.string  :purchase_base_on_sales                    ,:limit => 10 ,:default => '否' #以销定采，为否时，下拉框中不需要选择销售订单
      t.integer :is_locked     ,:limit => 1                ,:default => 1 #锁定 1为True 0为False
      t.integer :lock_version  ,:default => 0  #乐观锁
      t.timestamps
    end
  end

  def self.down
    drop_table :sys_params
  end
end
